package com.peak.distribution.entity.agent;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.LazyToOne;
import org.hibernate.annotations.LazyToOneOption;

import com.peak.distribution.enums.Constants;
import com.peak.distribution.enums.TradeType;
import com.peak.spring.boot.api.entity.DefaultStategyEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;

@Entity
@Table(name = "dis_agent_account_log")
@Data
@EqualsAndHashCode(callSuper=true)
public class DisAgentAccountLog extends DefaultStategyEntity {

	private static final long serialVersionUID = Constants.DISTRIBUTION_VERSION;

	/** 收支 */
	private Boolean inOut;
	
	/** 金额 */
	private Integer amount;
	
	/** 交易时间 */
	private Date tradeTime;
	
	/** 类型 */
	private TradeType type;
	
	/** 签名 */
	private String sign;
	
	/** 账户 */
	private DisAgentAccount account;

	@ManyToOne
	@JoinColumn(name = "account_id")
	@Fetch(FetchMode.SELECT)
	@LazyToOne(LazyToOneOption.PROXY)
	public DisAgentAccount getAccount() {
		return account;
	}
}
